<?php
declare (strict_types = 1);

namespace app\admin\controller;
use app\common\library\AlipayApi;
use brand\logic\BrandHelper;
use surface\Factory;
use think\facade\Cache;
use think\facade\Db;
use think\facade\Log;
use think\facade\Session;
use think\facade\View;
use function brand\e;


class Index extends Base
{

    protected $noNeedLogin = [];
    protected $noNeedRight = ['index','home','logout'];

    public function _initialize()
    {
        parent::_initialize();
        //移除HTML标签
        $this->request->filter('trim,strip_tags,htmlspecialchars');
    }

    public function index()
    {

        //左侧菜单
        $menulist = $this->auth->getSidebar();

        View::assign('menu', $menulist);

        return View::fetch();
    }

    public function home()
    {
        return View::fetch();
    }


    public function logout()
    {
        Session::delete('admin');
        return _success('退出成功', [], (string)url('login/index'));
    }

    public function clean()
    {
        Cache::clear();
        Log::clear();
        del_dir(runtime_path('temp'));
        return _success("缓存文件清理完成");
    }



}
